﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using LPY.LeHealth.Service;
using LPY.LeHealth.DTO;

namespace LPY.LeHealth.WebSite.Controllers
{
    public class hystypeController : Controller
    {
        private zhinantype Zhinantype;
        // GET: hystype
        public ActionResult Index()
        {
            return View();
        }
        public hystypeController()
        {
            Zhinantype = new zhinantype();
        }
        /// <summary>
        /// 显示全部类型信息
        /// </summary>
        /// <returns></returns>
        public ActionResult showall()
        {
            List<PhysicalType> list = Zhinantype.showall();
            return Json(list, JsonRequestBehavior.AllowGet);
        }
        /// <summary>
        /// 显示前几条类型
        /// </summary>
        /// <returns></returns>
        public ActionResult showzhinanInfo()
        {
            List<PhysicalType> list = Zhinantype.showptype();
            return Json(list, JsonRequestBehavior.AllowGet);
        }
        /// <summary>
        /// 显示剩下的类型
        /// </summary>
        /// <returns></returns>
        public ActionResult getend()
        {
            List<PhysicalType> list = Zhinantype.getendall();
            return Json(list, JsonRequestBehavior.AllowGet);
        }
        /// <summary>
        /// 添加指南类型
        /// </summary>
        /// <param name="Pname"></param>
        /// <returns></returns>
        public int add(string Pname)
        { 
            PhysicalType ph=new PhysicalType ();
            ph.PhysicalName=Pname;
            if (Zhinantype.add(ph) > 0)
            {
                return 1;

            }
            else
            {
                return 0;
            }
        }
    }
}